/*
 * @Author: your name
 * @Date: 2020-11-16 22:40:07
 * @LastEditTime: 2020-11-16 22:58:31
 * @LastEditors: Please set LastEditors
 * @Description: In User Settings Edit
 * @FilePath: \movie\routers\admin\hot.js
 */
//后台登录页路由
const { join } = require( 'path' );
const express = require( 'express' );
const router = express.Router();

//文件上传中间件
const multer = require( 'multer' );
//得到一个上传对象
const uploader = multer( {
  dest:join(__dirname,'../../static/uploads')
})
//引入控制器

const hotController = require( '../../controllers/admin/hotController' )

// 文件上传控制器
const UploadController = require('../../controllers/admin/UploadController')

// 文件上传 /admin/upfile
router.post( '/upfile', uploader.single( 'file' ), UploadController.upfile );


router.get( '/hot/index', hotController.index );
//添加显示
router.get( '/hot/create', hotController.create );
//表单post提交
router.post( '/hot/create',uploader.single('file'), hotController.store );

module.exports = router;
